#include<iostream>
#include<cstring>
using namespace std;
int main(){
	char s[100];
	char *p[100]={0};
	char o[100];
	char *tmp;
	cout<<"Input:";
	fgets(s,100,stdin);
	strcpy(o,s);
	int flag=0;
	p[flag++]=o;
	int l = strlen(o);
	for(int i=0;i<l;i++){
		if(o[i]==' '||o[i]=='?'||o[i]=='.'||o[i]==','||o[i]=='!') {
			o[i]=0;
			if(o[i+1]!=' '&&o[i+1]!='?'&&o[i+1]!='.'&&o[i+1]!=','&&o[i+1]!='!') p[flag++]=&o[i+1];
		}
	}
	int i=0;
	puts("Words:");
	while(p[i]){puts(p[i]);i++;}
	return 0; 
}